﻿Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes

Namespace Views
    Partial Public Class ViewPreviewBase

        Public Sub New()
            MyBase.New()

            Me.InitializeComponent()

            ' Insert code required on object creation below this point.
        End Sub

        Private Sub ListBox_PreviewMouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
            'TODO: Add event handler implementation here.
            DragDrop.DoDragDrop(sender, sender, DragDropEffects.Copy)
        End Sub

        Private Sub ListBox_Drop(ByVal sender As Object, ByVal e As System.Windows.DragEventArgs)
            Dim lst As ListBox = sender
            Dim coll As ICollection(Of DataColumn) = lst.ItemsSource
            Try
                If Not coll.Contains(CType(e.Data.GetData(GetType(ListBox)), ListBox).SelectedItem) Then
                    coll.Add(CType(e.Data.GetData(GetType(ListBox)), ListBox).SelectedItem)
                End If
            Catch ex As Exception

            End Try
            Dim vm As ViewModels.ViewModelPreviewBase = DataContext
            vm.Recalculate()
            'lst.Items.Add(CType(e.Data.GetData(GetType(ListBox)), ListBox).SelectedItem.ToString())
        End Sub

        Private Sub Render()
            Dim vm As ViewModels.ViewModelPreviewBase = DataContext
            dg.Columns.Clear()

        End Sub
    End Class
End Namespace